const mysql = require('mysql')
const con = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'123456',
    port:'3306',
    database:"poor"
})

con.connect()

function exec(sql){
    return new Promise((resolve,reject)=>{
        con.query(sql,(err,result)=>{
            if(err){
                reject(err);
                return
            }
            resolve(result);
        })
    })
}

module.exports = {exec}